package com.itqf;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/12/23
 * @Time: 上午10:58
 */
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients //开启feign伪装调用
public class EurekaClientConsumerFeignApplication {

    public  static  void  main(String[]args){
        SpringApplication.run(EurekaClientConsumerFeignApplication.class,args);
    }

    @Bean
    @LoadBalanced  //负载均衡
    public RestTemplate restTemplate(){
//        URL url = new URL("http://localhost:8082/findAll");
//        HttpURLConnection connection = url.openConnection();
//        if (connection.getResponseCode()==200){
//            BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
//            String s = br.readLine();
//
//
//
//        }




        System.out.println("测试");
        //调用服务
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate;
    }

}
